﻿CREATE TABLE [dbo].[AmixRegistru] (
    [IDMijlocFix]             INT             IDENTITY (1, 1) NOT NULL,
    [NrInventar]              VARCHAR (20)    NOT NULL,
    [ContAmortizare]          [dbo].[TipCont] NULL,
    [StocFaptic]              INT             CONSTRAINT [DF_AmixRegistru_StocFaptic] DEFAULT ((1)) NOT NULL,
    [IDClasificare]           INT             CONSTRAINT [DF_RegistruAmix_IDClasificare] DEFAULT ((0)) NOT NULL,
    [DataIntrare]             DATETIME        CONSTRAINT [DF_RegistruAmix_DataIntrare] DEFAULT (getdate()) NOT NULL,
    [DataIesire]              DATETIME        CONSTRAINT [DF_RegistruAmix_DataIesire] DEFAULT (getdate()) NOT NULL,
    [CodUnitate]              SMALLINT        CONSTRAINT [DF_RegistruAmix_CodUnitate] DEFAULT ((0)) NOT NULL,
    [IDDepartament]           INT             CONSTRAINT [DF_RegistruAmix_IDDepartament] DEFAULT ((0)) NOT NULL,
    [IDStare]                 SMALLINT        CONSTRAINT [DF_RegistruAmix_IDStare] DEFAULT ((0)) NOT NULL,
    [ContImobilizare]         [dbo].[TipCont] NULL,
    [ContCheltuiala]          [dbo].[TipCont] NULL,
    [DurataAmortizare]        INT             CONSTRAINT [DF_AmixRegistru_DurataAmortizare] DEFAULT ((0)) NOT NULL,
    [RegimAmortizare]         SMALLINT        CONSTRAINT [DF_AmixRegistru_RegimAmortizare] DEFAULT ((0)) NOT NULL,
    [ValoareInventar]         DECIMAL (18, 2) CONSTRAINT [DF_AmixRegistru_ValoareInventar] DEFAULT ((0)) NOT NULL,
    [PunereInFunctiune]       DATETIME        CONSTRAINT [DF_AmixRegistru_PunereInFunctiune] DEFAULT (getdate()) NOT NULL,
    [Compus]                  SMALLINT        CONSTRAINT [DF_AmixRegistru_Compus] DEFAULT ((0)) NOT NULL,
    [Blocat]                  BIT             CONSTRAINT [DF_AmixRegistru_Blocat] DEFAULT ((0)) NOT NULL,
    [IDGestionar]             SMALLINT        CONSTRAINT [DF_AmixRegistru_IDGestionar] DEFAULT ((1)) NOT NULL,
    [ContTransfer]            [dbo].[TipCont] NULL,
    [ValoareAmortizata]       DECIMAL (18, 2) CONSTRAINT [DF_AmixRegistru_ValoareAmortizata] DEFAULT ((0)) NOT NULL,
    [LuniAmortizate]          INT             CONSTRAINT [DF_AmixRegistru_LuniAmortizate] DEFAULT ((0)) NOT NULL,
    [AmortizareLuna]          DECIMAL (18, 2) CONSTRAINT [DF_AmixRegistru_AmortizareLuna] DEFAULT ((0)) NOT NULL,
    [AmortizareAn]            DECIMAL (18, 2) CONSTRAINT [DF_AmixRegistru_AmortizareAn] DEFAULT ((0)) NOT NULL,
    [InFolosinta]             BIT             CONSTRAINT [DF_AmixRegistru_InFolosinta] DEFAULT ((0)) NULL,
    [Categorie]               VARCHAR (100)   NULL,
    [IDUnitateMasura]         SMALLINT        NULL,
    [ContTransferForSuperior] [dbo].[TipCont] NULL,
    [IDJurnal]                INT             NULL,
    [ValoareIntrataTransfer]  DECIMAL (25, 2) NULL,
    [Denumire]                VARCHAR (250)   CONSTRAINT [DF_AmixRegistru_Den] DEFAULT ('') NOT NULL,
    [CantitateOI]             DECIMAL (18, 2) DEFAULT ((0)) NOT NULL,
    [IDSursaFinantare]        SMALLINT        NULL,
    CONSTRAINT [PK_RegistruAmix] PRIMARY KEY CLUSTERED ([IDMijlocFix] ASC),
    CONSTRAINT [FK_AmixRegistru_AmixGestionari] FOREIGN KEY ([IDGestionar]) REFERENCES [dbo].[AmixGestionari] ([IDGestionar]),
    CONSTRAINT [FK_AmixRegistru_Jurnale] FOREIGN KEY ([IDJurnal]) REFERENCES [dbo].[Jurnale] ([IDJurnal]),
    CONSTRAINT [FK_AmixRegistru_SurseFinantare] FOREIGN KEY ([IDSursaFinantare]) REFERENCES [dbo].[SurseFinantare] ([IDSursaFinantare]),
    CONSTRAINT [FK_RegistruAmix_Departamente] FOREIGN KEY ([IDDepartament]) REFERENCES [dbo].[Departamente] ([IDDepartament]),
    CONSTRAINT [FK_RegistruAmix_TipStareMFix] FOREIGN KEY ([IDStare]) REFERENCES [dbo].[AmixTipStare] ([IDStare]),
    CONSTRAINT [FK_RegistruAmix_Unitati] FOREIGN KEY ([CodUnitate]) REFERENCES [dbo].[Unitati] ([CodUnitate]),
    CONSTRAINT [IX_RegistruAmix] UNIQUE NONCLUSTERED ([NrInventar] ASC, [CodUnitate] ASC)
);

